export default {
	chooseFile ({title, suffix, multiple, success, fail}) {
		uni.navigateTo({
			url: `/modules/chooseFile?title=${title || ''}&suffix=${suffix || ''}&multiple=${multiple || ''}`,
			animationType: 'slide-in-right',
			complete: (res) => {
				uni.$once('choose-file', (data) => {
					uni.navigateBack({delta: 1});
					try{
						success ? success(data) : null
					}catch(e){
						fail ? fail(e) : null
					}
				})
			}
		});
	},
	exchange ({id, success, fail}) {
		uni.navigateTo({
			url: `/modules/exchange?id=${id}`,
			animationType: 'fade-in',
			complete: (res) => {
				uni.$once('exchange', (data) => {
					uni.navigateBack({delta: 1});
					try{
						success ? success(data) : null
					}catch(e){
						fail ? fail(e) : null
					}
				})
			}
		});
	}
}